package com.example.demo.conditionaldemo;

import org.springframework.boot.autoconfigure.condition.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

@Configuration
public class ConditionalConfigDemo {
    @Bean
//    @ConditionalOnBean(name = "userMapper")
//    @ConditionalOnMissingBean(name = "userMapper")
//    @ConditionalOnClass(name = "userMapper")
//    @ConditionalOnProperty(prefix = "conditional.demo",value = "enable")
//    @ConditionalOnProperty(prefix = "conditional.demo",value = "enable",havingValue = "true",matchIfMissing = true)
//    @ConditionalOnClass(name ="com.example.demo.conditionaldemo.ConditionalBeanObj")
    @ConditionalOnResource(resources = {"com/example/demo/importdemo/CacheService.class"})
    public ConditionalBeanObj conditionalBeanObj() {
        return new ConditionalBeanObj();
    }


}
